<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <div id="screen">hello world</div>
  <button id="btn1">这是获取内容按钮</button>
  <button id="btn2">这是修改内容按钮</button>
  

  <script>
    let btn = document.querySelector('#btn1');
    btn.onclick = function(){
      let screen = document.querySelector('#screen');
      // 通过innerHTML获取内容
      console.log(screen.innerHTML);
    }

    let btn2 = document.querySelector('#btn2');
    btn2.onclick = function(){
      let screen = document.querySelector('#screen');
      screen.innerHTML = '<h1>这是韩公公</h1>';
    }
  </script>
</body>
</html>